(new ApiResolver('module'))
	.enumerateMatches('exports:*!SSL_*')
	.filter(x => ['SSL_read', 'SSL_write'].some(y => x.name.indexOf(y) >= 0))
	.forEach(x => {
		Interceptor.attach(x.address, {
			onEnter: function (args) {
				// int SSL_read(SSL *ssl, void *buf, int num);
				// int SSL_write(SSL *ssl, const void *buf, int num);
				const buf = ptr(args[1]);
				const num = args[2].toInt32();
				console.log(x.name, buf, num);

				// const data = buf.readByteArray(num);
				// const data = buf.readCString(num
				// const data = buf.readUtf8String(num);
				// const data = buf.readUtf16String(num);
				const data = buf.readAnsiString(num);
				console.log(data);
			},
			onLeave: function (retval) {
				console.log(x.name, retval);
			}
		})
	});